package tests;


import java.awt.*;
import java.applet.Applet;
import java.util.Timer;
import java.util.TimerTask;

import javax.swing.JLabel;

public class Layout extends Applet {
       public JLabel Napis;

   static public Applet naszAplet;

   public void init( )
   {
         Timer timer = new Timer( );
         Zadaniee zadanie = new Zadaniee( );

         timer.schedule(zadanie, 2000, 900);

         naszAplet = this;

                setLayout(new GridLayout(3,3));
                Napis = new JLabel("x");
                add(new Button("1"));
                add(new Button("2"));
                add(new Button("3"));
                add(new Button("4"));
                add(new Button("5"));
                add(new Button("6"));
                add(Napis);

        }

       public boolean keyDown(Event evt, int keyCode) {


                   boolean czy = false;

                   // Interpret the keycode
                   if (keyCode == Event.UP) {
                       this.Napis.setText("UP");
                   } else
                   if (keyCode == Event.RIGHT) {
                       this.Napis.setText("RIGHT");
                   } else
                   if (keyCode == Event.DOWN) {
                       this.Napis.setText("DOWN");
                   } else
                   if (keyCode == Event.LEFT) {
                       this.Napis.setText("LEFT");;
                   } else
                   if (keyCode == Event.ESCAPE) {
                       this.Napis.setText("ESC");
                   }
                   return czy;
       }


}
